//
//  Common.h
//  TVstalk
//
//  Created by RainSets on 6/7/14.
//  Copyright (c) 2014 RainSets. All rights reserved.
//

#import "FinderViewController.h"
#import "CommunityViewController.h"
#import "HomeViewController.h"
#import "PersonCenterViewController.h"
#import "BuyClassesViewController.h"
#import "SVProgressHUD.h"
#import <MediaPlayer/MediaPlayer.h>
#import "WeAppHttpManager.h"


#ifndef WeApp_Common_h
#define WeApp_Common_h


#define IS_IPHONE (!IS_IPAD)

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone)

#define IS_IPHONE5 CGSizeEqualToSize([[UIScreen mainScreen] preferredMode].size,CGSizeMake(640, 1136))
#define IS_IPHONE6 CGSizeEqualToSize([[UIScreen mainScreen] preferredMode].size,CGSizeMake(750, 1334))
#define IS_IPHONE6Plus CGSizeEqualToSize([[UIScreen mainScreen] preferredMode].size,CGSizeMake(1242, 2208))
#define IS_IPHONE4 CGSizeEqualToSize([[UIScreen mainScreen] preferredMode].size,CGSizeMake(640, 960))

#define IS_GREATERTHAN_IPHONE5 [[UIScreen mainScreen] preferredMode].size.height > 1136.f
#define IS_IOS7ANDLATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.f
#define IS_IOS8 [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.f
#define IS_IOS7 ([[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue] >= 7.f&&[[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue] < 8)

#define kUserDefaultSyn [[NSUserDefaults standardUserDefaults] synchronize]
#define kUserDefault(key) [[NSUserDefaults standardUserDefaults] objectForKey:key]
#define kUserDefaultSet(obj,key) [[NSUserDefaults standardUserDefaults] setObject:obj forKey:key];
#define kUserDefaultBool(key) [[NSUserDefaults standardUserDefaults] boolForKey:key]
#define kUserDefaultBoolSet(show,key) [[NSUserDefaults standardUserDefaults] setBool:show forKey:key];
#define kUserDefaultRemove(key) [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]

//exchange nslog to dslog
#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...)
#endif

#define COLORRGBA(r,g,b,a) [UIColor colorWithRed:(r) / 255.0f           \
green:(g) / 255.0f           \
blue:(b) / 255.0f           \
alpha:(a)]

#define TopLineColor COLORRGBA(230,46,107,1.0)


#define LabelTextColor COLORRGBA(93,93,93,1.0)
#define SelfLightGrayColor COLORRGBA(255,255,255,1.0)
#define SelfBlueGrayColor  COLORRGBA(234,234,232,1.0)
#define FZLTXHK_CHFont(fontSize) [UIFont fontWithName:@"FZLTXHK" size:fontSize]

#define APPDELEGATE ((AppDelegate *)[UIApplication sharedApplication].delegate)

#define TMC [TMCache sharedCache]

#define userInfoID @"userInfoID"
#define userModel @"userModel"


#define iPhone6Size CGSizeMake(375.f,667.f*2)
#define iPhone6PlusSize CGSizeMake(414.f,736.f*2)


#define TMC [TMCache sharedCache]


#define GAODEMAPKEY @"063160434e8773f0b90a94d44a15b386"

#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? YES : NO)
#define StatusBarHeight (IOS7==YES ? 0 : 20)
#define fDeviceWidth ([UIScreen mainScreen].bounds.size.width)
#define fDeviceHeight ([UIScreen mainScreen].bounds.size.height-StatusBarHeight)



#endif
